home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Online / CNetDemo / cnet / sdk / include / control.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-04  |  11.1 KB  |  240 lines

  1.  
  2. #ifndef CNET_CONTROL
  3. #define CNET_CONTROL
  4.  
  5. #include "ports.h"
  6. #include "config.h"
  7.  
  8. struct   PortConfig {
  9.    UBYTE   online;         // port loaded or not
  10.    UBYTE   open;           // 1==perm, 2==call only
  11.  
  12.    UBYTE   check;          // menu:  BITS 0=DoorsClosed, 1=FilesClosed, 2=MsgsClosed
  13.                            //             3=NoNewUsers,  4=SysopIsIn
  14.                            // see also: MainPort->check_latch
  15.  
  16.    UBYTE   idle;           // clock, SAG, SAM ?
  17.  
  18.    UBYTE   offline;        // port loaded, but modem offline
  19.    UBYTE   not_used;
  20.  
  21.    UBYTE   bplanes;
  22.    UBYTE   lace;           // 0=none, 1=24 line, 2=49 line
  23.  
  24.    USHORT   sizes[8];      // workbench window & zoom size
  25. };
  26.  
  27.  
  28. struct MainPortExtension
  29.    {
  30.    struct SignalSemaphore sem[20];  // sem[0] = lock reload_text variable..
  31.                                     // sem[1] = lock idd (identd data) before insertion/removal
  32.                                     // sem[2] = lock the global MailKill list
  33.                                     // sem[3] = lock IMP list
  34.                                     // sem[4] = lock HOSTNAME/SPAM filter config file before accessing
  35.                                     // sem[5] = lock uumail dir - causes mail-task to "pause" until this semaphore is released
  36.                                     //          mail-task will obtain a lock on sem[5] before it tries to access uumail dir.
  37.                                     // sem[6] = lock global MIME list (myp->MPE->mimelist)
  38.                                     // sem[7..19] not yet assigned/used.
  39.  
  40.    UBYTE reload_text;               // set to 1 to cause control to reload text/menu.
  41.                                     // you MUST ObtainSemphore(&myp->MPE->sem[0]) before accessing!
  42.  
  43.    UBYTE newsman_up;    // 0 if news-task not running..
  44.                         // 1 if running and window open
  45.                         // 2 if running and iconified or menufied
  46.  
  47.    struct Task   *newstask;     // pointer to news-task Task structure if running.
  48.    struct IdentdData *idd;      // linked list of identd info for in-use clients
  49.    struct List *MailKillList;   // standard Exec List with Node ln_name(s) containing the list of mail kill patterns
  50.    struct List *CPortList;      // Exec list used for Control listview - PRIVATE - accessing this variable may result in unpredictable results
  51.  
  52.    UBYTE UpdateGUI_notused;     // ** expansion - not used
  53.  
  54.    struct ConfigExtension gc2;  // second set of config variables
  55.  
  56.    struct List IMPList;         // Exec list of IMPStruct(s) - be sure to
  57.                                 //   ObtainSemaphore(&myp->MPE->sem[3])
  58.                                 //   before accessing and
  59.                                 // ReleaseSemaphore(&myp->MPE->sem[3]) afterwards.
  60.    char *statline;              // pointer to allocated Control stats line
  61.  
  62.    struct SignalSemaphore *MailSem;   // user account mail semaphores
  63.                                       // pointers to structures for CNet mailbox locking.
  64.                                       //   Each array memeber applies to its ordinal
  65.                                       // account_number-1.
  66.                                       // eg. MailSem[0] is account 1
  67.                                       //     MailSem[1] is account 2 etc,.
  68.  
  69.    UBYTE smtpd_up;           // 0 if SMTPd not running..
  70.                              // 1 if running and window open
  71.                              // 2 if running and iconified or menufied
  72.    struct Task *smtpdtask;   // pointer to cnsmtpd Task structure if running.
  73.    
  74.    struct MIMEContentType *mimelist;    // linked list of sysop-configured MIMEContentTypes. (see mail.h)
  75.    };
  76.  
  77.  
  78. struct MainPort {          // common, public to all ports
  79.                            // the same msgport that Findport("cnetport")
  80.                            // returns a pointer to..
  81.  
  82.    struct  MsgPort mp;     // 0  - standard EXEC message port
  83.    char    portName[22];   // 34
  84.  
  85.    char    LastOn[32];     // 56
  86.  
  87.    long   Nums[5];         //  88 [0] # of physical user accounts
  88.                            //     [1] # of in-use user accounts
  89.                            //     [2] last assigned unique ID Number
  90.                            //     [3] # of calls to system TOTAL
  91.                            //     [4] # of calls now logged
  92.  
  93.    ULONG   SAG[2][72];             // 108 activity graph
  94.    long   SAM[5][15];              // activity monitor
  95.    struct   IsDate SAMDate[6];
  96.  
  97.    long   um[10];          // for C programmer use.  You can
  98.                            // (typecast) them as you need to.
  99.                            // Initially at bootup == 0
  100.  
  101.    struct   Window      *PWindow;        // pointer to control window if open; otherwise 0
  102.    struct   TransType   *FirstTT;
  103.    struct   SubboardType4 *Subboard;
  104.    struct   LinkPort   *link;            // all-linked port users!
  105.    struct   KeyElement4   *Key;          // alpha order, etc.
  106.    short      *IName;                    // Indexes into KeyElement4 array
  107.    short      *IPhone;                   // Indexes into KeyElement4 array
  108.    char      *SubTitle;
  109.    struct   MailLock   *mlock;
  110.    struct   ChargeSet   *FirstCharge;
  111.  
  112.    long   ns;           // number of subs in memory (allocated)
  113.  
  114.    UBYTE   toss_up;     // 0 if toss not running..
  115.                         // 1 if running
  116.                         // 2 if running and iconified
  117.                         // 3 if running and menufied
  118.    UBYTE   yank_up;     // TRUE if yank-task running..
  119.    UBYTE   serv_exit;   // internally set as TRUE to tell mail-task, yank-task and any other "server" programs to quit - control is closing down/quitting
  120.    UBYTE   item_up;     // not used
  121.    
  122.    UBYTE   mail_up;     // 0 if mail-task not running..
  123.                         // 1 if running
  124.                         // 2 if running and iconified or menufied
  125.  
  126.    UBYTE   fileman_up;  // 0 if file-task not running..
  127.                         // 1 if running
  128.                         // 2 if running and iconified or menufied
  129.  
  130.  
  131.    UBYTE useredit_up;   // 29-Jul-97
  132.                         // is UserEd running?  Control cannot exit until UserEd quits
  133.  
  134.    UBYTE expansion1[5]; // future expansion
  135.  
  136.    long   OpenPfiles;   // number of currently open doors
  137.  
  138.    struct   NoiseType   *FirstNT;
  139.  
  140.    long   ClickMaint;   // can we use local mouse maint?
  141.    long   Verbose;      // do not redirect to NIL: for debug
  142.  
  143.    long   s1;           // version of CONTROL
  144.    long   s2;
  145.    long   s3;           // serial number of owner 0==DEMO
  146.  
  147.    struct   BitMap  ClockBrush;   // 40 bytes - for the large port clock on idle ports
  148.    struct   SignalSemaphore SEM[19];
  149.  
  150.                // for critical structure/file/variable locking..
  151.                // Don't hold these in LOCKED state for long
  152.                // as DEADLOCKS will occur!
  153.  
  154.                // ObtainSemaphore(SEM[x]) to lock, ReleaseSemaphore(SEM[x]) to unlock
  155.                // SEM[0]  = for locking myp (MainPort) itself!
  156.                // SEM[1]  = User myp->Key[], myp->IName, myp->PName, myp->Phone locking
  157.                // SEM[2]  = z.Upload/z.nuploads/z.NoUploaded locking
  158.                // SEM[3]  = for locking serial device
  159.                // SEM[4]  = myp->NUMS[1] locking (NUMS[1] = number of user account currently active
  160.                // SEM[5]  = net/echomail import/export,  subbards3/4 data file and COMPLETE allocated subboard locking - lock before altering/ordering subboard structures
  161.                // SEM[7]  = conference (join) chat locking
  162.                // SEM[8]  = joinlink/conference (join) ROOM locking
  163.                // SEM[10] = Pfile locking
  164.                // SEM[11] = bbs.udata, bbs.cuser & userlist locking
  165.                // SEM[12] = sysdata:log/%s locking
  166.                // SEM[13] = semaphore for locking LIST items - ie. items in a type "LIST" subboard
  167.                // SEM[14] = vote list locking while reading/editing vote items/results
  168.                // SEM[16] = lock before accessing the CopyCDRom() function
  169.                // SEM[18] = semaphore for locking SAM
  170.                                        
  171.  
  172.    struct   AccessGroup     AGC[32];   // BBS.ADATA / Access Group stuff
  173.  
  174.    struct   NewConfig1 gc;             // global configuration defaults
  175.  
  176.    char   SysPassword[6][21];
  177.    ULONG   IDQ;
  178.  
  179.    short   root;                       // first area#
  180.    struct   PortConfig  pc   [101];    // For CONTROL, remembers things about each port's window menus, etc,..
  181.    struct   PortData   *PortZ[100];    // pointers to each port's PortData struct
  182.    struct   Room       *CRoom[100];    // pointers to ROOM structures..
  183.  
  184.    struct   ULock *FirstULock;         // Account Locking ... list of dynamically locked accounts!
  185.    short   LastTickHour;               // control is ticking ...
  186.    short   LastTickMinute;
  187.  
  188.    short   HiPort; // highest port loaded
  189.    short   nPorts;
  190.  
  191.    char   regto[32], regco[32];
  192.  
  193.    struct   SignalSemaphore ysem;      // the 3.1 Yank-Task
  194.    struct   YankType *yfirst;
  195.  
  196.    struct   SignalSemaphore isem;      // WAS the 3.1 Item-Task = not used
  197.    struct   ItemServerType *ifirst;    // not used!
  198.  
  199.    struct   SignalSemaphore csem;      // the 3.1 Charge-Server
  200.    struct   ChargeType *cfirst;
  201.  
  202.    struct   SignalSemaphore sem;
  203.  
  204.    struct   PortData *z0;              // control's PortData structure - copied to other ports as default, when opened..
  205.  
  206.    /* new for v4.12 */
  207.    UBYTE      cron_up;                 /* non-zero if events are being externally edited - Control WILL NOT exit as long as this is >0 */
  208.    struct   JobType4 *Events;          /* configured events */
  209.    struct   SignalSemaphore eventsem;  /* lock this using ObtainSemaphore() before altering myp->Events! */
  210.                                        /* make sure to release using ReleaseSemaphore() after changing events list */
  211.  
  212.    struct   SignalSemaphore cesem;     /* control event semaphore locking  - internal use only! */
  213.    struct   JobType4   *cEvents;       /* list of events to be executed by Control */
  214.  
  215.    struct   SignalSemaphore flsem;     /* semaphore for locking the LIST of file locks */
  216.  
  217.    struct   Library *NodelistBase;     /* traplist.library - nodelist base */
  218.  
  219.    UBYTE check_latch;      // 3rd party coders - SET this (1=SET) if ANY of the PortConfig "check" bits are altered via doors
  220.                            //                    changes will not take effect unless this is latched!!
  221.  
  222.    // task pointers Added in v4.21/v4.22 - used to send signals to CNet servers
  223.    // ie. use Signal(myp->mailtask, SIGBREAKF_CTRL_C) to tell mail-task to quit
  224.    //
  225.    //     note: server will set it's myp->#?task pointer to ZERO when it exits
  226.    //           You cannot be sure the task has exited until it's Task pointer
  227.    //           is 0.  Also, if a server is processing a packet (ie. mail item,
  228.    //           test/transform, NNTPGet etc, the task/server will not exit
  229.    //           until the current operation is complete.
  230.    //
  231.    struct Task   *mailtask;               // pointer to mail-task task structure
  232.    struct Task   *filetask;               // pointer to file-task task structure
  233.    struct Task   *nntptask;               // pointer to nntpget task structure
  234.    struct Task   *yanktask;               // pointer to yank-task task structure
  235.  
  236.    struct MainPortExtension *MPE;         // MainPort data extensions - see struct MainPortExtension above.
  237. };
  238.  
  239. #endif
  240.